﻿Imports System.Text

<TestClass()>
Public Class ContactTests

#Region "---TestEmailMailTo---"
    <TestMethod()>
    Public Sub TestEmailMailTo()
        Dim target As New DotNetNuke.Modules.GeminorumSoftwareContacts.Contact
        target.Email = "jonathanmterry@netscape.net"
        Assert.AreEqual(target.EmailMailTo, "mailto:" & target.Email)
    End Sub
#End Region
#Region "---TestKeyID---"
    <TestMethod()>
    Public Sub TestKeyID()
        Dim target As New DotNetNuke.Modules.GeminorumSoftwareContacts.Contact
        target.ID = 1000
        Assert.AreEqual(1000, target.KeyID)

        target.KeyID = 4982
        Assert.AreEqual(4982, target.ID)
    End Sub
#End Region
#Region "---TestFill---"
    <TestMethod()>
    Public Sub TestFill()
        Dim testDataReader As New TestDataReader
        Dim target As New DotNetNuke.Modules.GeminorumSoftwareContacts.Contact
        target.Fill(testDataReader)

        Assert.AreEqual("111-222-3333", target.CellPhoneNumber)
        Assert.AreEqual("jonathanmterry@netscape.net", target.Email)
        Assert.AreEqual(1000, target.ID)
        Assert.AreEqual(1, target.ModuleID)
        Assert.AreEqual("Name", target.Name)
        Assert.AreEqual("444-555-6666", target.PhoneNumber)
        Assert.AreEqual("Title", target.Title)
    End Sub
#End Region

#Region "---TestDataReader---"
    Private Class TestDataReader
        Implements IDataReader

        Public Sub Close() Implements System.Data.IDataReader.Close

        End Sub

        Public ReadOnly Property Depth As Integer Implements System.Data.IDataReader.Depth
            Get

            End Get
        End Property

        Public Function GetSchemaTable() As System.Data.DataTable Implements System.Data.IDataReader.GetSchemaTable

        End Function

        Public ReadOnly Property IsClosed As Boolean Implements System.Data.IDataReader.IsClosed
            Get

            End Get
        End Property

        Public Function NextResult() As Boolean Implements System.Data.IDataReader.NextResult

        End Function

        Public Property ReadCalled As Boolean
        Public Function Read() As Boolean Implements System.Data.IDataReader.Read
            ReadCalled = True
        End Function

        Public ReadOnly Property RecordsAffected As Integer Implements System.Data.IDataReader.RecordsAffected
            Get

            End Get
        End Property

        Public ReadOnly Property FieldCount As Integer Implements System.Data.IDataRecord.FieldCount
            Get

            End Get
        End Property

        Public Function GetBoolean(i As Integer) As Boolean Implements System.Data.IDataRecord.GetBoolean

        End Function

        Public Function GetByte(i As Integer) As Byte Implements System.Data.IDataRecord.GetByte

        End Function

        Public Function GetBytes(i As Integer, fieldOffset As Long, buffer() As Byte, bufferoffset As Integer, length As Integer) As Long Implements System.Data.IDataRecord.GetBytes

        End Function

        Public Function GetChar(i As Integer) As Char Implements System.Data.IDataRecord.GetChar

        End Function

        Public Function GetChars(i As Integer, fieldoffset As Long, buffer() As Char, bufferoffset As Integer, length As Integer) As Long Implements System.Data.IDataRecord.GetChars

        End Function

        Public Function GetData(i As Integer) As System.Data.IDataReader Implements System.Data.IDataRecord.GetData

        End Function

        Public Function GetDataTypeName(i As Integer) As String Implements System.Data.IDataRecord.GetDataTypeName

        End Function

        Public Function GetDateTime(i As Integer) As Date Implements System.Data.IDataRecord.GetDateTime

        End Function

        Public Function GetDecimal(i As Integer) As Decimal Implements System.Data.IDataRecord.GetDecimal

        End Function

        Public Function GetDouble(i As Integer) As Double Implements System.Data.IDataRecord.GetDouble

        End Function

        Public Function GetFieldType(i As Integer) As System.Type Implements System.Data.IDataRecord.GetFieldType

        End Function

        Public Function GetFloat(i As Integer) As Single Implements System.Data.IDataRecord.GetFloat

        End Function

        Public Function GetGuid(i As Integer) As System.Guid Implements System.Data.IDataRecord.GetGuid

        End Function

        Public Function GetInt16(i As Integer) As Short Implements System.Data.IDataRecord.GetInt16

        End Function

        Public Function GetInt32(i As Integer) As Integer Implements System.Data.IDataRecord.GetInt32

        End Function

        Public Function GetInt64(i As Integer) As Long Implements System.Data.IDataRecord.GetInt64

        End Function

        Public Function GetName(i As Integer) As String Implements System.Data.IDataRecord.GetName

        End Function

        Public Function GetOrdinal(name As String) As Integer Implements System.Data.IDataRecord.GetOrdinal

        End Function

        Public Function GetString(i As Integer) As String Implements System.Data.IDataRecord.GetString

        End Function

        Public Function GetValue(i As Integer) As Object Implements System.Data.IDataRecord.GetValue

        End Function

        Public Function GetValues(values() As Object) As Integer Implements System.Data.IDataRecord.GetValues

        End Function

        Public Function IsDBNull(i As Integer) As Boolean Implements System.Data.IDataRecord.IsDBNull

        End Function

        Default Public Overloads ReadOnly Property Item(i As Integer) As Object Implements System.Data.IDataRecord.Item
            Get

            End Get
        End Property

        Default Public Overloads ReadOnly Property Item(name As String) As Object Implements System.Data.IDataRecord.Item
            Get
                Select Case name
                    Case "CellPhone"
                        Return "111-222-3333"
                    Case "Email"
                        Return "jonathanmterry@netscape.net"
                    Case "ID"
                        Return 1000
                    Case "ModuleID"
                        Return 1
                    Case "Name"
                        Return "Name"
                    Case "PhoneNumber"
                        Return "444-555-6666"
                    Case "Title"
                        Return "Title"
                End Select
            End Get
        End Property

#Region "IDisposable Support"
        Private disposedValue As Boolean ' To detect redundant calls

        ' IDisposable
        Protected Overridable Sub Dispose(disposing As Boolean)
            If Not Me.disposedValue Then
                If disposing Then
                    ' TODO: dispose managed state (managed objects).
                End If

                ' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
                ' TODO: set large fields to null.
            End If
            Me.disposedValue = True
        End Sub

        ' TODO: override Finalize() only if Dispose(ByVal disposing As Boolean) above has code to free unmanaged resources.
        'Protected Overrides Sub Finalize()
        '    ' Do not change this code.  Put cleanup code in Dispose(ByVal disposing As Boolean) above.
        '    Dispose(False)
        '    MyBase.Finalize()
        'End Sub

        ' This code added by Visual Basic to correctly implement the disposable pattern.
        Public Sub Dispose() Implements IDisposable.Dispose
            ' Do not change this code.  Put cleanup code in Dispose(ByVal disposing As Boolean) above.
            Dispose(True)
            GC.SuppressFinalize(Me)
        End Sub
#End Region

    End Class
#End Region
End Class